package com.gitee.funcy.multiple.datasource.controller;

import com.gitee.funcy.multiple.datasource.domain.query.UserQuery;
import com.gitee.funcy.multiple.datasource.domain.User;
import com.gitee.funcy.multiple.datasource.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * ｛这里添加描述｝
 *
 * @author funcy
 * @date 2019-09-25 21:45
 */
@Controller
@RequestMapping("/api/user")
public class UserController {

    @Autowired
    private IUserService userService;

    /**
     * 访问：
     * http://localhost:8084/api/user/get?appId=1
     * http://localhost:8084/api/user/get?appId=2
     * http://localhost:8084/api/user/get?appId=3
     *
     * @param query
     * @return
     */
    @ResponseBody
    @RequestMapping("get")
    public List<User> getUser(UserQuery query) {
        return userService.selectByQuery(query);
    }

}
